#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "IntervalConstraint.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class TimeInterval;

/// <summary>
/// TimeConstraint
/// A TimeConstraint is a Constraint that refers to a TimeInterval.
/// </summary>
class UMLMODEL_EXPORT TimeConstraint : public IntervalConstraint {

public: // Constructors and destructors
    explicit TimeConstraint(const QString& umlType="uml::TimeConstraint");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// firstEvent getter
    /// The value of firstEvent is related to the constrainedElement. If firstEvent is
    /// true, then the corresponding observation event is the first time instant the
    /// execution enters the constrainedElement. If firstEvent is false, then the
    /// corresponding observation event is the last time instant the execution is within
    /// the constrainedElement.
    /// </summary>
    bool firstEvent() const;

    /// <summary>
    /// firstEvent setter
    /// The value of firstEvent is related to the constrainedElement. If firstEvent is
    /// true, then the corresponding observation event is the first time instant the
    /// execution enters the constrainedElement. If firstEvent is false, then the
    /// corresponding observation event is the last time instant the execution is within
    /// the constrainedElement.
    /// </summary>
    void setFirstEvent(bool value);

    /// <summary>
    /// specification getter
    /// TheTimeInterval constraining the duration.
    /// </summary>
    shared_ptr<TimeInterval> specification() const;

    /// <summary>
    /// specification setter
    /// TheTimeInterval constraining the duration.
    /// </summary>
    void setSpecification(shared_ptr<TimeInterval> value);

private: // Fields
    /// <summary>
    /// firstEvent
    /// The value of firstEvent is related to the constrainedElement. If firstEvent is
    /// true, then the corresponding observation event is the first time instant the
    /// execution enters the constrainedElement. If firstEvent is false, then the
    /// corresponding observation event is the last time instant the execution is within
    /// the constrainedElement.
    /// </summary>
    const static bool firstEvent_default_;
    bool firstEvent_= firstEvent_default_;

    /// <summary>
    /// specification
    /// TheTimeInterval constraining the duration.
    /// </summary>
    shared_ptr<TimeInterval> specification_;

};

} // namespace uml
